Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>This example uses the addEventListener() method on the window object.</p> <p>Try resizing this browser window to trigger the "resize" event handler.</p> <p id="demo"></p> <script> window.addEventListener("resize", function(){ document.getElementById("demo").innerHTML = Math.random(); }); </script> </body> <!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_addeventlistener_dom by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:36:35 GMT --> </html>
Result:
Try it Yourself - © w3schools.com